package com.google.android.exoplayer2.extractor.mkv;

import android.util.Pair;
import android.util.SparseArray;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.audio.Ac3Util;
import com.google.android.exoplayer2.drm.DrmInitData;
import com.google.android.exoplayer2.drm.DrmInitData.SchemeData;
import com.google.android.exoplayer2.extractor.Extractor;
import com.google.android.exoplayer2.video.ColorInfo;
import com.huawei.appgallery.festivalanimation.particle.modifiers.SizeModifier;
import com.huawei.hms.framework.network.restclient.hwhttp.dns.DnsConfig;
import com.huawei.hms.support.api.entity.core.JosStatusCodes;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import o.adt;
import o.adv;
import o.adw;
import o.ady;
import o.adz;
import o.aea;
import o.aea.e;
import o.aef;
import o.aej;
import o.aek;
import o.aeq;
import o.aer;
import o.aes;
import o.amm;
import o.amv;
import o.amz;
import o.anb;
import o.anc;
import o.and;
import o.anr;
import o.anw;
import o.any;

public final class MatroskaExtractor implements Extractor {
    public static final adw ˊ = aer.ˋ;
    private static final byte[] ˋ = new byte[]{(byte) 32, (byte) 32, (byte) 32, (byte) 32, (byte) 32, (byte) 32, (byte) 32, (byte) 32, (byte) 32, (byte) 32, (byte) 32, (byte) 32};
    private static final byte[] ˎ = anr.ˊ("Format: Start, End, ReadOrder, Layer, Style, Name, MarginL, MarginR, MarginV, Effect, Text");
    private static final byte[] ˏ = new byte[]{(byte) 49, (byte) 10, (byte) 48, (byte) 48, (byte) 58, (byte) 48, (byte) 48, (byte) 58, (byte) 48, (byte) 48, (byte) 44, (byte) 48, (byte) 48, (byte) 48, (byte) 32, (byte) 45, (byte) 45, (byte) 62, (byte) 32, (byte) 48, (byte) 48, (byte) 58, (byte) 48, (byte) 48, (byte) 58, (byte) 48, (byte) 48, (byte) 44, (byte) 48, (byte) 48, (byte) 48, (byte) 10};
    private static final byte[] ॱ = new byte[]{(byte) 68, (byte) 105, (byte) 97, (byte) 108, (byte) 111, (byte) 103, (byte) 117, (byte) 101, (byte) 58, (byte) 32, (byte) 48, (byte) 58, (byte) 48, (byte) 48, (byte) 58, (byte) 48, (byte) 48, (byte) 58, (byte) 48, (byte) 48, (byte) 44, (byte) 48, (byte) 58, (byte) 48, (byte) 48, (byte) 58, (byte) 48, (byte) 48, (byte) 58, (byte) 48, (byte) 48, (byte) 44};
    private static final UUID ॱॱ = new UUID(72057594037932032L, -9223371306706625679L);
    private static final byte[] ᐝ = new byte[]{(byte) 32, (byte) 32, (byte) 32, (byte) 32, (byte) 32, (byte) 32, (byte) 32, (byte) 32, (byte) 32, (byte) 32};
    private final aes ʻ;
    private final anc ʻॱ;
    private final SparseArray<d> ʼ;
    private long ʼॱ;
    private final aej ʽ;
    private long ʽॱ;
    private long ʾ;
    private ByteBuffer ʿ;
    private long ˈ;
    private boolean ˉ;
    private int ˊˊ;
    private long ˊˋ;
    private final anc ˊॱ;
    private d ˊᐝ;
    private long ˋˊ;
    private long ˋˋ;
    private final anc ˋॱ;
    private long ˋᐝ;
    private boolean ˌ;
    private long ˍ;
    private amv ˎˎ;
    private boolean ˎˏ;
    private int ˏˎ;
    private long ˏˏ;
    private final boolean ˏॱ;
    private long ˑ;
    private final anc ͺ;
    private amv ͺॱ;
    private int ـ;
    private int ॱʻ;
    private int ॱʼ;
    private int ॱʽ;
    private final anc ॱˊ;
    private final anc ॱˋ;
    private final anc ॱˎ;
    private int[] ॱͺ;
    private final anc ॱᐝ;
    private boolean ᐝˊ;
    private int ᐝˋ;
    private final anc ᐝॱ;
    private boolean ᐝᐝ;
    private boolean ᐧ;
    private int ᐨ;
    private byte ᶥ;
    private int ㆍ;
    private int ꓸ;
    private int ꜞ;
    private boolean ꜟ;
    private boolean ꞌ;
    private boolean ﾞ;
    private ady ﾟ;

    final class a implements EbmlReaderOutput {
        final /* synthetic */ MatroskaExtractor ˊ;

        private a(MatroskaExtractor matroskaExtractor) {
            this.ˊ = matroskaExtractor;
        }

        public int ॱ(int i) {
            switch (i) {
                case 131:
                case 136:
                case 155:
                case 159:
                case 176:
                case 179:
                case 186:
                case 215:
                case 231:
                case 241:
                case 251:
                case 16980:
                case 17029:
                case 17143:
                case 18401:
                case 18408:
                case 20529:
                case 20530:
                case 21420:
                case 21432:
                case 21680:
                case 21682:
                case 21690:
                case 21930:
                case 21945:
                case 21946:
                case 21947:
                case 21948:
                case 21949:
                case 22186:
                case 22203:
                case 25188:
                case 30321:
                case 2352003:
                case 2807729:
                    return 2;
                case 134:
                case 17026:
                case 21358:
                case 2274716:
                    return 3;
                case 160:
                case 174:
                case 183:
                case 187:
                case 224:
                case 225:
                case 18407:
                case 19899:
                case 20532:
                case 20533:
                case 21936:
                case 21968:
                case 25152:
                case 28032:
                case 30320:
                case 290298740:
                case 357149030:
                case 374648427:
                case 408125543:
                case 440786851:
                case 475249515:
                case 524531317:
                    return 1;
                case 161:
                case 163:
                case 16981:
                case 18402:
                case 21419:
                case 25506:
                case 30322:
                    return 4;
                case 181:
                case 17545:
                case 21969:
                case 21970:
                case 21971:
                case 21972:
                case 21973:
                case 21974:
                case 21975:
                case 21976:
                case 21977:
                case 21978:
                case 30323:
                case 30324:
                case 30325:
                    return 5;
                default:
                    return 0;
            }
        }

        public boolean ˎ(int i) {
            return i == 357149030 || i == 524531317 || i == 475249515 || i == 374648427;
        }

        public void ॱ(int i, long j, long j2) throws ParserException {
            this.ˊ.ॱ(i, j, j2);
        }

        public void ˊ(int i) throws ParserException {
            this.ˊ.ॱ(i);
        }

        public void ˋ(int i, long j) throws ParserException {
            this.ˊ.ˋ(i, j);
        }

        public void ˎ(int i, double d) throws ParserException {
            this.ˊ.ˏ(i, d);
        }

        public void ॱ(int i, String str) throws ParserException {
            this.ˊ.ॱ(i, str);
        }

        public void ˏ(int i, int i2, adv o_adv) throws IOException, InterruptedException {
            this.ˊ.ˋ(i, i2, o_adv);
        }
    }

    static final class b {
        private int ʼ;
        private long ˊ;
        private int ˋ;
        private boolean ˎ;
        private int ˏ;
        private final byte[] ॱ = new byte[10];

        public void ˏ() {
            this.ˎ = false;
        }

        public void ˏ(adv o_adv, int i, int i2) throws IOException, InterruptedException {
            if (!this.ˎ) {
                o_adv.ˎ(this.ॱ, 0, 10);
                o_adv.ˏ();
                if (Ac3Util.ˊ(this.ॱ) != 0) {
                    this.ˎ = true;
                    this.ˏ = 0;
                } else {
                    return;
                }
            }
            if (this.ˏ == 0) {
                this.ʼ = i;
                this.ˋ = 0;
            }
            this.ˋ += i2;
        }

        public void ˊ(d dVar, long j) {
            if (this.ˎ) {
                int i = this.ˏ;
                this.ˏ = i + 1;
                if (i == 0) {
                    this.ˊ = j;
                }
                if (this.ˏ >= 16) {
                    dVar.ᐝˋ.ˋ(this.ˊ, this.ʼ, this.ˋ, 0, dVar.ᐝ);
                    this.ˏ = 0;
                }
            }
        }

        public void ˎ(d dVar) {
            if (this.ˎ && this.ˏ > 0) {
                dVar.ᐝˋ.ˋ(this.ˊ, this.ʼ, this.ˋ, 0, dVar.ᐝ);
                this.ˏ = 0;
            }
        }
    }

    static final class d {
        public byte[] ʻ;
        public float ʻॱ;
        public DrmInitData ʼ;
        public int ʼॱ;
        public boolean ʽ;
        public int ʽॱ;
        public int ʾ;
        public boolean ʿ;
        public int ˈ;
        public int ˉ;
        public int ˊ;
        public float ˊˊ;
        public float ˊˋ;
        public int ˊॱ;
        public float ˊᐝ;
        public String ˋ;
        public int ˋˊ;
        public float ˋˋ;
        public int ˋॱ;
        public float ˋᐝ;
        public float ˌ;
        public float ˍ;
        public int ˎ;
        public float ˎˎ;
        public int ˎˏ;
        public String ˏ;
        public int ˏˎ;
        public float ˏˏ;
        public int ˏॱ;
        public int ˑ;
        public int ͺ;
        public float ͺॱ;
        public boolean ـ;
        public int ॱ;
        public boolean ॱʻ;
        public long ॱʼ;
        @Nullable
        public b ॱʽ;
        public int ॱˊ;
        public float ॱˋ;
        public int ॱˎ;
        public long ॱͺ;
        public byte[] ॱॱ;
        public byte[] ॱᐝ;
        public o.aef.d ᐝ;
        public aef ᐝˋ;
        public float ᐝॱ;
        public int ᐧ;
        private String ᐨ;

        private d() {
            this.ˊॱ = -1;
            this.ˋॱ = -1;
            this.ॱˊ = -1;
            this.ͺ = -1;
            this.ˏॱ = 0;
            this.ॱˎ = -1;
            this.ॱˋ = 0.0f;
            this.ʻॱ = 0.0f;
            this.ᐝॱ = 0.0f;
            this.ॱᐝ = null;
            this.ʾ = -1;
            this.ʿ = false;
            this.ʼॱ = -1;
            this.ʽॱ = -1;
            this.ˈ = -1;
            this.ˋˊ = 1000;
            this.ˉ = 200;
            this.ˊˋ = SizeModifier.STABLE_STATE_SCALE;
            this.ˊˊ = SizeModifier.STABLE_STATE_SCALE;
            this.ˊᐝ = SizeModifier.STABLE_STATE_SCALE;
            this.ˎˎ = SizeModifier.STABLE_STATE_SCALE;
            this.ˌ = SizeModifier.STABLE_STATE_SCALE;
            this.ˋᐝ = SizeModifier.STABLE_STATE_SCALE;
            this.ˋˋ = SizeModifier.STABLE_STATE_SCALE;
            this.ˍ = SizeModifier.STABLE_STATE_SCALE;
            this.ͺॱ = SizeModifier.STABLE_STATE_SCALE;
            this.ˏˏ = SizeModifier.STABLE_STATE_SCALE;
            this.ˎˏ = 1;
            this.ˏˎ = -1;
            this.ˑ = JosStatusCodes.RTN_CODE_COMMON_ERROR;
            this.ॱͺ = 0;
            this.ॱʼ = 0;
            this.ـ = true;
            this.ᐨ = "eng";
        }

        public void ॱ(ady o_ady, int i) throws ParserException {
            Format ˋ;
            int i2;
            int i3 = -1;
            int i4 = -1;
            List list = null;
            String str = this.ˏ;
            Object obj = -1;
            switch (str.hashCode()) {
                case -2095576542:
                    if (str.equals("V_MPEG4/ISO/AP")) {
                        obj = 5;
                        break;
                    }
                    break;
                case -2095575984:
                    if (str.equals("V_MPEG4/ISO/SP")) {
                        obj = 3;
                        break;
                    }
                    break;
                case -1985379776:
                    if (str.equals("A_MS/ACM")) {
                        obj = 22;
                        break;
                    }
                    break;
                case -1784763192:
                    if (str.equals("A_TRUEHD")) {
                        obj = 17;
                        break;
                    }
                    break;
                case -1730367663:
                    if (str.equals("A_VORBIS")) {
                        obj = 10;
                        break;
                    }
                    break;
                case -1482641358:
                    if (str.equals("A_MPEG/L2")) {
                        obj = 13;
                        break;
                    }
                    break;
                case -1482641357:
                    if (str.equals("A_MPEG/L3")) {
                        obj = 14;
                        break;
                    }
                    break;
                case -1373388978:
                    if (str.equals("V_MS/VFW/FOURCC")) {
                        obj = 8;
                        break;
                    }
                    break;
                case -933872740:
                    if (str.equals("S_DVBSUB")) {
                        obj = 28;
                        break;
                    }
                    break;
                case -538363189:
                    if (str.equals("V_MPEG4/ISO/ASP")) {
                        obj = 4;
                        break;
                    }
                    break;
                case -538363109:
                    if (str.equals("V_MPEG4/ISO/AVC")) {
                        obj = 6;
                        break;
                    }
                    break;
                case -425012669:
                    if (str.equals("S_VOBSUB")) {
                        obj = 26;
                        break;
                    }
                    break;
                case -356037306:
                    if (str.equals("A_DTS/LOSSLESS")) {
                        obj = 20;
                        break;
                    }
                    break;
                case 62923557:
                    if (str.equals("A_AAC")) {
                        obj = 12;
                        break;
                    }
                    break;
                case 62923603:
                    if (str.equals("A_AC3")) {
                        obj = 15;
                        break;
                    }
                    break;
                case 62927045:
                    if (str.equals("A_DTS")) {
                        obj = 18;
                        break;
                    }
                    break;
                case 82338133:
                    if (str.equals("V_VP8")) {
                        obj = null;
                        break;
                    }
                    break;
                case 82338134:
                    if (str.equals("V_VP9")) {
                        obj = 1;
                        break;
                    }
                    break;
                case 99146302:
                    if (str.equals("S_HDMV/PGS")) {
                        obj = 27;
                        break;
                    }
                    break;
                case 444813526:
                    if (str.equals("V_THEORA")) {
                        obj = 9;
                        break;
                    }
                    break;
                case 542569478:
                    if (str.equals("A_DTS/EXPRESS")) {
                        obj = 19;
                        break;
                    }
                    break;
                case 725957860:
                    if (str.equals("A_PCM/INT/LIT")) {
                        obj = 23;
                        break;
                    }
                    break;
                case 738597099:
                    if (str.equals("S_TEXT/ASS")) {
                        obj = 25;
                        break;
                    }
                    break;
                case 855502857:
                    if (str.equals("V_MPEGH/ISO/HEVC")) {
                        obj = 7;
                        break;
                    }
                    break;
                case 1422270023:
                    if (str.equals("S_TEXT/UTF8")) {
                        obj = 24;
                        break;
                    }
                    break;
                case 1809237540:
                    if (str.equals("V_MPEG2")) {
                        obj = 2;
                        break;
                    }
                    break;
                case 1950749482:
                    if (str.equals("A_EAC3")) {
                        obj = 16;
                        break;
                    }
                    break;
                case 1950789798:
                    if (str.equals("A_FLAC")) {
                        obj = 21;
                        break;
                    }
                    break;
                case 1951062397:
                    if (str.equals("A_OPUS")) {
                        obj = 11;
                        break;
                    }
                    break;
            }
            switch (obj) {
                case null:
                    str = "video/x-vnd.on2.vp8";
                    break;
                case 1:
                    str = "video/x-vnd.on2.vp9";
                    break;
                case 2:
                    str = "video/mpeg2";
                    break;
                case 3:
                case 4:
                case 5:
                    List list2;
                    str = "video/mp4v-es";
                    if (this.ॱॱ == null) {
                        list2 = null;
                    } else {
                        list2 = Collections.singletonList(this.ॱॱ);
                    }
                    list = list2;
                    break;
                case 6:
                    str = "video/avc";
                    anw ॱ = anw.ॱ(new anc(this.ॱॱ));
                    list = ॱ.ˋ;
                    this.ᐧ = ॱ.ˎ;
                    break;
                case 7:
                    str = "video/hevc";
                    any ˊ = any.ˊ(new anc(this.ॱॱ));
                    list = ˊ.ˏ;
                    this.ᐧ = ˊ.ॱ;
                    break;
                case 8:
                    Pair ˎ = ˎ(new anc(this.ॱॱ));
                    list = (List) ˎ.second;
                    str = (String) ˎ.first;
                    break;
                case 9:
                    str = "video/x-unknown";
                    break;
                case 10:
                    str = "audio/vorbis";
                    i3 = 8192;
                    list = ˏ(this.ॱॱ);
                    break;
                case 11:
                    str = "audio/opus";
                    i3 = 5760;
                    list = new ArrayList(3);
                    list.add(this.ॱॱ);
                    list.add(ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(this.ॱͺ).array());
                    list.add(ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(this.ॱʼ).array());
                    break;
                case 12:
                    str = "audio/mp4a-latm";
                    list = Collections.singletonList(this.ॱॱ);
                    break;
                case 13:
                    str = "audio/mpeg-L2";
                    i3 = 4096;
                    break;
                case 14:
                    str = "audio/mpeg";
                    i3 = 4096;
                    break;
                case 15:
                    str = "audio/ac3";
                    break;
                case 16:
                    str = "audio/eac3";
                    break;
                case 17:
                    str = "audio/true-hd";
                    this.ॱʽ = new b();
                    break;
                case 18:
                case 19:
                    str = "audio/vnd.dts";
                    break;
                case 20:
                    str = "audio/vnd.dts.hd";
                    break;
                case 21:
                    str = "audio/flac";
                    list = Collections.singletonList(this.ॱॱ);
                    break;
                case 22:
                    str = "audio/raw";
                    if (!ˋ(new anc(this.ॱॱ))) {
                        str = "audio/x-unknown";
                        amz.ˏ("MatroskaExtractor", "Non-PCM MS/ACM is unsupported. Setting mimeType to " + str);
                        break;
                    }
                    i4 = anr.ˊ(this.ˏˎ);
                    if (i4 == 0) {
                        i4 = -1;
                        str = "audio/x-unknown";
                        amz.ˏ("MatroskaExtractor", "Unsupported PCM bit depth: " + this.ˏˎ + ". Setting mimeType to " + str);
                        break;
                    }
                    break;
                case 23:
                    str = "audio/raw";
                    i4 = anr.ˊ(this.ˏˎ);
                    if (i4 == 0) {
                        i4 = -1;
                        str = "audio/x-unknown";
                        amz.ˏ("MatroskaExtractor", "Unsupported PCM bit depth: " + this.ˏˎ + ". Setting mimeType to " + str);
                        break;
                    }
                    break;
                case 24:
                    str = "application/x-subrip";
                    break;
                case 25:
                    str = "text/x-ssa";
                    break;
                case 26:
                    str = "application/vobsub";
                    list = Collections.singletonList(this.ॱॱ);
                    break;
                case 27:
                    str = "application/pgs";
                    break;
                case 28:
                    str = "application/dvbsubs";
                    list = Collections.singletonList(new byte[]{this.ॱॱ[0], this.ॱॱ[1], this.ॱॱ[2], this.ॱॱ[3]});
                    break;
                default:
                    throw new ParserException("Unrecognized codec identifier.");
            }
            int i5 = (0 | (this.ـ ? 1 : 0)) | (this.ॱʻ ? 2 : 0);
            if (anb.ˏ(str)) {
                ˋ = Format.ˋ(Integer.toString(i), str, null, -1, i3, this.ˎˏ, this.ˑ, i4, list, this.ʼ, i5, this.ᐨ);
                i2 = 1;
            } else if (anb.ˋ(str)) {
                int i6;
                int i7;
                if (this.ˏॱ == 0) {
                    this.ॱˊ = this.ॱˊ == -1 ? this.ˊॱ : this.ॱˊ;
                    if (this.ͺ == -1) {
                        i6 = this.ˋॱ;
                    } else {
                        i6 = this.ͺ;
                    }
                    this.ͺ = i6;
                }
                float f = SizeModifier.STABLE_STATE_SCALE;
                if (!(this.ॱˊ == -1 || this.ͺ == -1)) {
                    f = ((float) (this.ˋॱ * this.ॱˊ)) / ((float) (this.ˊॱ * this.ͺ));
                }
                ColorInfo colorInfo = null;
                if (this.ʿ) {
                    colorInfo = new ColorInfo(this.ʼॱ, this.ˈ, this.ʽॱ, ॱ());
                }
                i6 = -1;
                if ("htc_video_rotA-000".equals(this.ˋ)) {
                    i6 = 0;
                } else if ("htc_video_rotA-090".equals(this.ˋ)) {
                    i6 = 90;
                } else if ("htc_video_rotA-180".equals(this.ˋ)) {
                    i6 = 180;
                } else if ("htc_video_rotA-270".equals(this.ˋ)) {
                    i6 = 270;
                }
                if (this.ॱˎ == 0 && Float.compare(this.ॱˋ, 0.0f) == 0 && Float.compare(this.ʻॱ, 0.0f) == 0) {
                    if (Float.compare(this.ᐝॱ, 0.0f) == 0) {
                        i7 = 0;
                    } else if (Float.compare(this.ʻॱ, 90.0f) == 0) {
                        i7 = 90;
                    } else if (Float.compare(this.ʻॱ, -180.0f) == 0 || Float.compare(this.ʻॱ, 180.0f) == 0) {
                        i7 = 180;
                    } else if (Float.compare(this.ʻॱ, -90.0f) == 0) {
                        i7 = 270;
                    }
                    ˋ = Format.ˊ(Integer.toString(i), str, null, -1, i3, this.ˊॱ, this.ˋॱ, SizeModifier.STABLE_STATE_SCALE, list, i7, f, this.ॱᐝ, this.ʾ, colorInfo, this.ʼ);
                    i2 = 2;
                }
                i7 = i6;
                ˋ = Format.ˊ(Integer.toString(i), str, null, -1, i3, this.ˊॱ, this.ˋॱ, SizeModifier.STABLE_STATE_SCALE, list, i7, f, this.ॱᐝ, this.ʾ, colorInfo, this.ʼ);
                i2 = 2;
            } else if ("application/x-subrip".equals(str)) {
                ˋ = Format.ˊ(Integer.toString(i), str, i5, this.ᐨ, this.ʼ);
                i2 = 3;
            } else if ("text/x-ssa".equals(str)) {
                List arrayList = new ArrayList(2);
                arrayList.add(MatroskaExtractor.ˎ);
                arrayList.add(this.ॱॱ);
                ˋ = Format.ˏ(Integer.toString(i), str, null, -1, i5, this.ᐨ, -1, this.ʼ, Long.MAX_VALUE, arrayList);
                i2 = 3;
            } else if ("application/vobsub".equals(str) || "application/pgs".equals(str) || "application/dvbsubs".equals(str)) {
                ˋ = Format.ˏ(Integer.toString(i), str, null, -1, i5, list, this.ᐨ, this.ʼ);
                i2 = 3;
            } else {
                throw new ParserException("Unexpected MIME type.");
            }
            this.ᐝˋ = o_ady.ˊ(this.ˊ, i2);
            this.ᐝˋ.ˎ(ˋ);
        }

        public void ˏ() {
            if (this.ॱʽ != null) {
                this.ॱʽ.ˎ(this);
            }
        }

        public void ˎ() {
            if (this.ॱʽ != null) {
                this.ॱʽ.ˏ();
            }
        }

        private byte[] ॱ() {
            if (this.ˊˋ == SizeModifier.STABLE_STATE_SCALE || this.ˊˊ == SizeModifier.STABLE_STATE_SCALE || this.ˊᐝ == SizeModifier.STABLE_STATE_SCALE || this.ˎˎ == SizeModifier.STABLE_STATE_SCALE || this.ˌ == SizeModifier.STABLE_STATE_SCALE || this.ˋᐝ == SizeModifier.STABLE_STATE_SCALE || this.ˋˋ == SizeModifier.STABLE_STATE_SCALE || this.ˍ == SizeModifier.STABLE_STATE_SCALE || this.ͺॱ == SizeModifier.STABLE_STATE_SCALE || this.ˏˏ == SizeModifier.STABLE_STATE_SCALE) {
                return null;
            }
            byte[] bArr = new byte[25];
            ByteBuffer wrap = ByteBuffer.wrap(bArr);
            wrap.put((byte) 0);
            wrap.putShort((short) ((int) ((this.ˊˋ * 50000.0f) + 0.5f)));
            wrap.putShort((short) ((int) ((this.ˊˊ * 50000.0f) + 0.5f)));
            wrap.putShort((short) ((int) ((this.ˊᐝ * 50000.0f) + 0.5f)));
            wrap.putShort((short) ((int) ((this.ˎˎ * 50000.0f) + 0.5f)));
            wrap.putShort((short) ((int) ((this.ˌ * 50000.0f) + 0.5f)));
            wrap.putShort((short) ((int) ((this.ˋᐝ * 50000.0f) + 0.5f)));
            wrap.putShort((short) ((int) ((this.ˋˋ * 50000.0f) + 0.5f)));
            wrap.putShort((short) ((int) ((this.ˍ * 50000.0f) + 0.5f)));
            wrap.putShort((short) ((int) (this.ͺॱ + 0.5f)));
            wrap.putShort((short) ((int) (this.ˏˏ + 0.5f)));
            wrap.putShort((short) this.ˋˊ);
            wrap.putShort((short) this.ˉ);
            return bArr;
        }

        private static Pair<String, List<byte[]>> ˎ(anc o_anc) throws ParserException {
            try {
                o_anc.ˎ(16);
                long ॱˊ = o_anc.ॱˊ();
                if (ॱˊ == 1482049860) {
                    return new Pair("video/3gpp", null);
                }
                if (ॱˊ == 826496599) {
                    int ˋ = o_anc.ˋ() + 20;
                    byte[] bArr = o_anc.ˏ;
                    while (ˋ < bArr.length - 4) {
                        if (bArr[ˋ] == (byte) 0 && bArr[ˋ + 1] == (byte) 0 && bArr[ˋ + 2] == (byte) 1 && bArr[ˋ + 3] == (byte) 15) {
                            return new Pair("video/wvc1", Collections.singletonList(Arrays.copyOfRange(bArr, ˋ, bArr.length)));
                        }
                        ˋ++;
                    }
                    throw new ParserException("Failed to find FourCC VC1 initialization data");
                }
                amz.ˏ("MatroskaExtractor", "Unknown FourCC. Setting mimeType to video/x-unknown");
                return new Pair("video/x-unknown", null);
            } catch (ArrayIndexOutOfBoundsException e) {
                throw new ParserException("Error parsing FourCC private data");
            }
        }

        private static List<byte[]> ˏ(byte[] bArr) throws ParserException {
            int i = 0;
            try {
                if (bArr[0] != (byte) 2) {
                    throw new ParserException("Error parsing vorbis codec private");
                }
                int i2 = 0;
                int i3 = 1;
                while (bArr[i3] == (byte) -1) {
                    i3++;
                    i2 += 255;
                }
                int i4 = i3 + 1;
                i2 += bArr[i3];
                while (bArr[i4] == (byte) -1) {
                    i += 255;
                    i4++;
                }
                i3 = i4 + 1;
                i += bArr[i4];
                if (bArr[i3] != (byte) 1) {
                    throw new ParserException("Error parsing vorbis codec private");
                }
                Object obj = new byte[i2];
                System.arraycopy(bArr, i3, obj, 0, i2);
                i2 += i3;
                if (bArr[i2] != (byte) 3) {
                    throw new ParserException("Error parsing vorbis codec private");
                }
                i += i2;
                if (bArr[i] != (byte) 5) {
                    throw new ParserException("Error parsing vorbis codec private");
                }
                Object obj2 = new byte[(bArr.length - i)];
                System.arraycopy(bArr, i, obj2, 0, bArr.length - i);
                List<byte[]> arrayList = new ArrayList(2);
                arrayList.add(obj);
                arrayList.add(obj2);
                return arrayList;
            } catch (ArrayIndexOutOfBoundsException e) {
                throw new ParserException("Error parsing vorbis codec private");
            }
        }

        private static boolean ˋ(anc o_anc) throws ParserException {
            try {
                int ʼ = o_anc.ʼ();
                if (ʼ == 1) {
                    return true;
                }
                if (ʼ != 65534) {
                    return false;
                }
                o_anc.ˋ(24);
                if (o_anc.ॱˎ() == MatroskaExtractor.ॱॱ.getMostSignificantBits() && o_anc.ॱˎ() == MatroskaExtractor.ॱॱ.getLeastSignificantBits()) {
                    return true;
                }
                return false;
            } catch (ArrayIndexOutOfBoundsException e) {
                throw new ParserException("Error parsing MS/ACM codec private");
            }
        }
    }

    public MatroskaExtractor() {
        this(0);
    }

    public MatroskaExtractor(int i) {
        this(new aek(), i);
    }

    MatroskaExtractor(aej o_aej, int i) {
        this.ˈ = -1;
        this.ʾ = -9223372036854775807L;
        this.ʼॱ = -9223372036854775807L;
        this.ˋˊ = -9223372036854775807L;
        this.ˋˋ = -1;
        this.ˋᐝ = -1;
        this.ˍ = -9223372036854775807L;
        this.ʽ = o_aej;
        this.ʽ.ˋ(new a());
        this.ˏॱ = (i & 1) == 0;
        this.ʻ = new aes();
        this.ʼ = new SparseArray();
        this.ˋॱ = new anc(4);
        this.ॱˊ = new anc(ByteBuffer.allocate(4).putInt(-1).array());
        this.ʻॱ = new anc(4);
        this.ͺ = new anc(and.ˏ);
        this.ˊॱ = new anc(4);
        this.ॱˋ = new anc();
        this.ᐝॱ = new anc();
        this.ॱᐝ = new anc(8);
        this.ॱˎ = new anc();
    }

    public boolean ˎ(adv o_adv) throws IOException, InterruptedException {
        return new aeq().ॱ(o_adv);
    }

    public void ˏ(ady o_ady) {
        this.ﾟ = o_ady;
    }

    public void ˊ(long j, long j2) {
        this.ˍ = -9223372036854775807L;
        this.ˏˎ = 0;
        this.ʽ.ˎ();
        this.ʻ.ˊ();
        ˎ();
        for (int i = 0; i < this.ʼ.size(); i++) {
            ((d) this.ʼ.valueAt(i)).ˎ();
        }
    }

    public void ॱ() {
    }

    public int ˎ(adv o_adv, adz o_adz) throws IOException, InterruptedException {
        this.ﾞ = false;
        boolean z = true;
        while (z && !this.ﾞ) {
            z = this.ʽ.ˋ(o_adv);
            if (z && ˋ(o_adz, o_adv.ˊ())) {
                return 1;
            }
        }
        if (z) {
            return 0;
        }
        for (int i = 0; i < this.ʼ.size(); i++) {
            ((d) this.ʼ.valueAt(i)).ˏ();
        }
        return -1;
    }

    void ॱ(int i, long j, long j2) throws ParserException {
        switch (i) {
            case 160:
                this.ꞌ = false;
                return;
            case 174:
                this.ˊᐝ = new d();
                return;
            case 187:
                this.ˎˏ = false;
                return;
            case 19899:
                this.ˊˊ = -1;
                this.ˊˋ = -1;
                return;
            case 20533:
                this.ˊᐝ.ʽ = true;
                return;
            case 21968:
                this.ˊᐝ.ʿ = true;
                return;
            case 408125543:
                if (this.ˈ == -1 || this.ˈ == j) {
                    this.ˈ = j;
                    this.ʽॱ = j2;
                    return;
                }
                throw new ParserException("Multiple Segment elements not supported");
            case 475249515:
                this.ˎˎ = new amv();
                this.ͺॱ = new amv();
                return;
            case 524531317:
                if (!this.ˉ) {
                    if (!this.ˏॱ || this.ˋˋ == -1) {
                        this.ﾟ.ˎ(new e(this.ˋˊ));
                        this.ˉ = true;
                        return;
                    }
                    this.ˌ = true;
                    return;
                }
                return;
            default:
                return;
        }
    }

    void ॱ(int i) throws ParserException {
        switch (i) {
            case 160:
                if (this.ˏˎ == 2) {
                    if (!this.ꞌ) {
                        this.ᐨ |= 1;
                    }
                    ˋ((d) this.ʼ.get(this.ॱʼ), this.ˏˏ);
                    this.ˏˎ = 0;
                    return;
                }
                return;
            case 174:
                if (ॱ(this.ˊᐝ.ˏ)) {
                    this.ˊᐝ.ॱ(this.ﾟ, this.ˊᐝ.ˊ);
                    this.ʼ.put(this.ˊᐝ.ˊ, this.ˊᐝ);
                }
                this.ˊᐝ = null;
                return;
            case 19899:
                if (this.ˊˊ == -1 || this.ˊˋ == -1) {
                    throw new ParserException("Mandatory element SeekID or SeekPosition not found");
                } else if (this.ˊˊ == 475249515) {
                    this.ˋˋ = this.ˊˋ;
                    return;
                } else {
                    return;
                }
            case 25152:
                if (!this.ˊᐝ.ʽ) {
                    return;
                }
                if (this.ˊᐝ.ᐝ == null) {
                    throw new ParserException("Encrypted Track found but ContentEncKeyID was not found");
                }
                this.ˊᐝ.ʼ = new DrmInitData(new SchemeData(C.ˏ, "video/webm", this.ˊᐝ.ᐝ.ˋ));
                return;
            case 28032:
                if (this.ˊᐝ.ʽ && this.ˊᐝ.ʻ != null) {
                    throw new ParserException("Combining encryption and compression is not supported");
                }
                return;
            case 357149030:
                if (this.ʾ == -9223372036854775807L) {
                    this.ʾ = 1000000;
                }
                if (this.ʼॱ != -9223372036854775807L) {
                    this.ˋˊ = ॱ(this.ʼॱ);
                    return;
                }
                return;
            case 374648427:
                if (this.ʼ.size() == 0) {
                    throw new ParserException("No valid tracks were found");
                }
                this.ﾟ.ˊ();
                return;
            case 475249515:
                if (!this.ˉ) {
                    this.ﾟ.ˎ(ᐝ());
                    this.ˉ = true;
                    return;
                }
                return;
            default:
                return;
        }
    }

    void ˋ(int i, long j) throws ParserException {
        boolean z = true;
        d dVar;
        switch (i) {
            case 131:
                this.ˊᐝ.ˎ = (int) j;
                return;
            case 136:
                dVar = this.ˊᐝ;
                if (j != 1) {
                    z = false;
                }
                dVar.ـ = z;
                return;
            case 155:
                this.ˑ = ॱ(j);
                return;
            case 159:
                this.ˊᐝ.ˎˏ = (int) j;
                return;
            case 176:
                this.ˊᐝ.ˊॱ = (int) j;
                return;
            case 179:
                this.ˎˎ.ˋ(ॱ(j));
                return;
            case 186:
                this.ˊᐝ.ˋॱ = (int) j;
                return;
            case 215:
                this.ˊᐝ.ˊ = (int) j;
                return;
            case 231:
                this.ˍ = ॱ(j);
                return;
            case 241:
                if (!this.ˎˏ) {
                    this.ͺॱ.ˋ(j);
                    this.ˎˏ = true;
                    return;
                }
                return;
            case 251:
                this.ꞌ = true;
                return;
            case 16980:
                if (j != 3) {
                    throw new ParserException("ContentCompAlgo " + j + " not supported");
                }
                return;
            case 17029:
                if (j < 1 || j > 2) {
                    throw new ParserException("DocTypeReadVersion " + j + " not supported");
                }
                return;
            case 17143:
                if (j != 1) {
                    throw new ParserException("EBMLReadVersion " + j + " not supported");
                }
                return;
            case 18401:
                if (j != 5) {
                    throw new ParserException("ContentEncAlgo " + j + " not supported");
                }
                return;
            case 18408:
                if (j != 1) {
                    throw new ParserException("AESSettingsCipherMode " + j + " not supported");
                }
                return;
            case 20529:
                if (j != 0) {
                    throw new ParserException("ContentEncodingOrder " + j + " not supported");
                }
                return;
            case 20530:
                if (j != 1) {
                    throw new ParserException("ContentEncodingScope " + j + " not supported");
                }
                return;
            case 21420:
                this.ˊˋ = this.ˈ + j;
                return;
            case 21432:
                switch ((int) j) {
                    case 0:
                        this.ˊᐝ.ʾ = 0;
                        return;
                    case 1:
                        this.ˊᐝ.ʾ = 2;
                        return;
                    case 3:
                        this.ˊᐝ.ʾ = 1;
                        return;
                    case 15:
                        this.ˊᐝ.ʾ = 3;
                        return;
                    default:
                        return;
                }
            case 21680:
                this.ˊᐝ.ॱˊ = (int) j;
                return;
            case 21682:
                this.ˊᐝ.ˏॱ = (int) j;
                return;
            case 21690:
                this.ˊᐝ.ͺ = (int) j;
                return;
            case 21930:
                dVar = this.ˊᐝ;
                if (j != 1) {
                    z = false;
                }
                dVar.ॱʻ = z;
                return;
            case 21945:
                switch ((int) j) {
                    case 1:
                        this.ˊᐝ.ˈ = 2;
                        return;
                    case 2:
                        this.ˊᐝ.ˈ = 1;
                        return;
                    default:
                        return;
                }
            case 21946:
                switch ((int) j) {
                    case 1:
                    case 6:
                    case 7:
                        this.ˊᐝ.ʽॱ = 3;
                        return;
                    case 16:
                        this.ˊᐝ.ʽॱ = 6;
                        return;
                    case 18:
                        this.ˊᐝ.ʽॱ = 7;
                        return;
                    default:
                        return;
                }
            case 21947:
                this.ˊᐝ.ʿ = true;
                switch ((int) j) {
                    case 1:
                        this.ˊᐝ.ʼॱ = 1;
                        return;
                    case 4:
                    case 5:
                    case 6:
                    case 7:
                        this.ˊᐝ.ʼॱ = 2;
                        return;
                    case 9:
                        this.ˊᐝ.ʼॱ = 6;
                        return;
                    default:
                        return;
                }
            case 21948:
                this.ˊᐝ.ˋˊ = (int) j;
                return;
            case 21949:
                this.ˊᐝ.ˉ = (int) j;
                return;
            case 22186:
                this.ˊᐝ.ॱͺ = j;
                return;
            case 22203:
                this.ˊᐝ.ॱʼ = j;
                return;
            case 25188:
                this.ˊᐝ.ˏˎ = (int) j;
                return;
            case 30321:
                switch ((int) j) {
                    case 0:
                        this.ˊᐝ.ॱˎ = 0;
                        return;
                    case 1:
                        this.ˊᐝ.ॱˎ = 1;
                        return;
                    case 2:
                        this.ˊᐝ.ॱˎ = 2;
                        return;
                    case 3:
                        this.ˊᐝ.ॱˎ = 3;
                        return;
                    default:
                        return;
                }
            case 2352003:
                this.ˊᐝ.ॱ = (int) j;
                return;
            case 2807729:
                this.ʾ = j;
                return;
            default:
                return;
        }
    }

    void ˏ(int i, double d) {
        switch (i) {
            case 181:
                this.ˊᐝ.ˑ = (int) d;
                return;
            case 17545:
                this.ʼॱ = (long) d;
                return;
            case 21969:
                this.ˊᐝ.ˊˋ = (float) d;
                return;
            case 21970:
                this.ˊᐝ.ˊˊ = (float) d;
                return;
            case 21971:
                this.ˊᐝ.ˊᐝ = (float) d;
                return;
            case 21972:
                this.ˊᐝ.ˎˎ = (float) d;
                return;
            case 21973:
                this.ˊᐝ.ˌ = (float) d;
                return;
            case 21974:
                this.ˊᐝ.ˋᐝ = (float) d;
                return;
            case 21975:
                this.ˊᐝ.ˋˋ = (float) d;
                return;
            case 21976:
                this.ˊᐝ.ˍ = (float) d;
                return;
            case 21977:
                this.ˊᐝ.ͺॱ = (float) d;
                return;
            case 21978:
                this.ˊᐝ.ˏˏ = (float) d;
                return;
            case 30323:
                this.ˊᐝ.ॱˋ = (float) d;
                return;
            case 30324:
                this.ˊᐝ.ʻॱ = (float) d;
                return;
            case 30325:
                this.ˊᐝ.ᐝॱ = (float) d;
                return;
            default:
                return;
        }
    }

    void ॱ(int i, String str) throws ParserException {
        switch (i) {
            case 134:
                this.ˊᐝ.ˏ = str;
                return;
            case 17026:
                if (!"webm".equals(str) && !"matroska".equals(str)) {
                    throw new ParserException("DocType " + str + " not supported");
                }
                return;
            case 21358:
                this.ˊᐝ.ˋ = str;
                return;
            case 2274716:
                this.ˊᐝ.ᐨ = str;
                return;
            default:
                return;
        }
    }

    void ˋ(int i, int i2, adv o_adv) throws IOException, InterruptedException {
        switch (i) {
            case 161:
            case 163:
                if (this.ˏˎ == 0) {
                    this.ॱʼ = (int) this.ʻ.ˊ(o_adv, false, true, 8);
                    this.ـ = this.ʻ.ˋ();
                    this.ˑ = -9223372036854775807L;
                    this.ˏˎ = 1;
                    this.ˋॱ.ˏ();
                }
                d dVar = (d) this.ʼ.get(this.ॱʼ);
                if (dVar == null) {
                    o_adv.ॱ(i2 - this.ـ);
                    this.ˏˎ = 0;
                    return;
                }
                if (this.ˏˎ == 1) {
                    int i3;
                    ˊ(o_adv, 3);
                    int i4 = (this.ˋॱ.ˏ[2] & 6) >> 1;
                    if (i4 == 0) {
                        this.ॱʽ = 1;
                        this.ॱͺ = ˊ(this.ॱͺ, 1);
                        this.ॱͺ[0] = (i2 - this.ـ) - 3;
                    } else if (i != 163) {
                        throw new ParserException("Lacing only supported in SimpleBlocks.");
                    } else {
                        ˊ(o_adv, 4);
                        this.ॱʽ = (this.ˋॱ.ˏ[3] & 255) + 1;
                        this.ॱͺ = ˊ(this.ॱͺ, this.ॱʽ);
                        if (i4 == 2) {
                            Arrays.fill(this.ॱͺ, 0, this.ॱʽ, ((i2 - this.ـ) - 4) / this.ॱʽ);
                        } else if (i4 == 1) {
                            r5 = 0;
                            i3 = 4;
                            for (i4 = 0; i4 < this.ॱʽ - 1; i4++) {
                                this.ॱͺ[i4] = 0;
                                do {
                                    i3++;
                                    ˊ(o_adv, i3);
                                    r6 = this.ˋॱ.ˏ[i3 - 1] & 255;
                                    r7 = this.ॱͺ;
                                    r7[i4] = r7[i4] + r6;
                                } while (r6 == 255);
                                r5 += this.ॱͺ[i4];
                            }
                            this.ॱͺ[this.ॱʽ - 1] = ((i2 - this.ـ) - i3) - r5;
                        } else if (i4 == 3) {
                            r5 = 0;
                            i3 = 4;
                            i4 = 0;
                            while (i4 < this.ॱʽ - 1) {
                                this.ॱͺ[i4] = 0;
                                i3++;
                                ˊ(o_adv, i3);
                                if (this.ˋॱ.ˏ[i3 - 1] == (byte) 0) {
                                    throw new ParserException("No valid varint length mask found");
                                }
                                long j = 0;
                                int i5 = 0;
                                while (i5 < 8) {
                                    int i6 = 1 << (7 - i5);
                                    if ((this.ˋॱ.ˏ[i3 - 1] & i6) != 0) {
                                        int i7 = i3 - 1;
                                        i3 += i5;
                                        ˊ(o_adv, i3);
                                        j = (long) ((this.ˋॱ.ˏ[i7] & 255) & (i6 ^ -1));
                                        for (i6 = i7 + 1; i6 < i3; i6++) {
                                            j = ((long) (this.ˋॱ.ˏ[i6] & 255)) | (j << 8);
                                        }
                                        if (i4 > 0) {
                                            j -= (1 << ((i5 * 7) + 6)) - 1;
                                        }
                                        if (j >= -2147483648L || j > 2147483647L) {
                                            throw new ParserException("EBML lacing sample size out of range.");
                                        }
                                        r6 = (int) j;
                                        r7 = this.ॱͺ;
                                        if (i4 != 0) {
                                            r6 += this.ॱͺ[i4 - 1];
                                        }
                                        r7[i4] = r6;
                                        r5 += this.ॱͺ[i4];
                                        i4++;
                                    } else {
                                        i5++;
                                    }
                                }
                                if (j >= -2147483648L) {
                                    break;
                                }
                                throw new ParserException("EBML lacing sample size out of range.");
                            }
                            this.ॱͺ[this.ॱʽ - 1] = ((i2 - this.ـ) - i3) - r5;
                        } else {
                            throw new ParserException("Unexpected lacing value: " + i4);
                        }
                    }
                    this.ˏˏ = this.ˍ + ॱ((long) ((this.ˋॱ.ˏ[0] << 8) | (this.ˋॱ.ˏ[1] & 255)));
                    Object obj = (this.ˋॱ.ˏ[2] & 8) == 8 ? 1 : null;
                    Object obj2 = (dVar.ˎ == 2 || (i == 163 && (this.ˋॱ.ˏ[2] & DnsConfig.MAX_CACHE_ENTRIES) == DnsConfig.MAX_CACHE_ENTRIES)) ? 1 : null;
                    i3 = obj2 != null ? 1 : 0;
                    if (obj != null) {
                        i4 = Integer.MIN_VALUE;
                    } else {
                        i4 = 0;
                    }
                    this.ᐨ = i4 | i3;
                    this.ˏˎ = 2;
                    this.ॱʻ = 0;
                }
                if (i == 163) {
                    while (this.ॱʻ < this.ॱʽ) {
                        ˏ(o_adv, dVar, this.ॱͺ[this.ॱʻ]);
                        ˋ(dVar, this.ˏˏ + ((long) ((this.ॱʻ * dVar.ॱ) / 1000)));
                        this.ॱʻ++;
                    }
                    this.ˏˎ = 0;
                    return;
                }
                ˏ(o_adv, dVar, this.ॱͺ[0]);
                return;
            case 16981:
                this.ˊᐝ.ʻ = new byte[i2];
                o_adv.ˏ(this.ˊᐝ.ʻ, 0, i2);
                return;
            case 18402:
                byte[] bArr = new byte[i2];
                o_adv.ˏ(bArr, 0, i2);
                this.ˊᐝ.ᐝ = new o.aef.d(1, bArr, 0, 0);
                return;
            case 21419:
                Arrays.fill(this.ʻॱ.ˏ, (byte) 0);
                o_adv.ˏ(this.ʻॱ.ˏ, 4 - i2, i2);
                this.ʻॱ.ˋ(0);
                this.ˊˊ = (int) this.ʻॱ.ˋॱ();
                return;
            case 25506:
                this.ˊᐝ.ॱॱ = new byte[i2];
                o_adv.ˏ(this.ˊᐝ.ॱॱ, 0, i2);
                return;
            case 30322:
                this.ˊᐝ.ॱᐝ = new byte[i2];
                o_adv.ˏ(this.ˊᐝ.ॱᐝ, 0, i2);
                return;
            default:
                throw new ParserException("Unexpected id: " + i);
        }
    }

    private void ˋ(d dVar, long j) {
        if (dVar.ॱʽ != null) {
            dVar.ॱʽ.ˊ(dVar, j);
        } else {
            if ("S_TEXT/UTF8".equals(dVar.ˏ)) {
                ˋ(dVar, "%02d:%02d:%02d,%03d", 19, 1000, ˋ);
            } else if ("S_TEXT/ASS".equals(dVar.ˏ)) {
                ˋ(dVar, "%01d:%02d:%02d:%02d", 21, 10000, ᐝ);
            }
            dVar.ᐝˋ.ˋ(j, this.ᐨ, this.ꜞ, 0, dVar.ᐝ);
        }
        this.ﾞ = true;
        ˎ();
    }

    private void ˎ() {
        this.ᐝˋ = 0;
        this.ꜞ = 0;
        this.ㆍ = 0;
        this.ᐧ = false;
        this.ᐝˊ = false;
        this.ꜟ = false;
        this.ꓸ = 0;
        this.ᶥ = (byte) 0;
        this.ᐝᐝ = false;
        this.ॱˋ.ˏ();
    }

    private void ˊ(adv o_adv, int i) throws IOException, InterruptedException {
        if (this.ˋॱ.ॱ() < i) {
            if (this.ˋॱ.ˎ() < i) {
                this.ˋॱ.ॱ(Arrays.copyOf(this.ˋॱ.ˏ, Math.max(this.ˋॱ.ˏ.length * 2, i)), this.ˋॱ.ॱ());
            }
            o_adv.ˏ(this.ˋॱ.ˏ, this.ˋॱ.ॱ(), i - this.ˋॱ.ॱ());
            this.ˋॱ.ॱ(i);
        }
    }

    private void ˏ(adv o_adv, d dVar, int i) throws IOException, InterruptedException {
        boolean z = true;
        if ("S_TEXT/UTF8".equals(dVar.ˏ)) {
            ˋ(o_adv, ˏ, i);
        } else if ("S_TEXT/ASS".equals(dVar.ˏ)) {
            ˋ(o_adv, ॱ, i);
        } else {
            int i2;
            int ʽॱ;
            aef o_aef = dVar.ᐝˋ;
            if (!this.ᐧ) {
                if (dVar.ʽ) {
                    this.ᐨ &= -1073741825;
                    if (!this.ᐝˊ) {
                        o_adv.ˏ(this.ˋॱ.ˏ, 0, 1);
                        this.ᐝˋ++;
                        if ((this.ˋॱ.ˏ[0] & DnsConfig.MAX_CACHE_ENTRIES) == DnsConfig.MAX_CACHE_ENTRIES) {
                            throw new ParserException("Extension bit is set in signal byte");
                        }
                        this.ᶥ = this.ˋॱ.ˏ[0];
                        this.ᐝˊ = true;
                    }
                    if ((this.ᶥ & 1) == 1) {
                        boolean z2;
                        int i3;
                        if ((this.ᶥ & 2) == 2) {
                            z2 = true;
                        } else {
                            z2 = false;
                        }
                        this.ᐨ |= 1073741824;
                        if (!this.ᐝᐝ) {
                            o_adv.ˏ(this.ॱᐝ.ˏ, 0, 8);
                            this.ᐝˋ += 8;
                            this.ᐝᐝ = true;
                            byte[] bArr = this.ˋॱ.ˏ;
                            if (z2) {
                                i3 = DnsConfig.MAX_CACHE_ENTRIES;
                            } else {
                                i3 = 0;
                            }
                            bArr[0] = (byte) (i3 | 8);
                            this.ˋॱ.ˋ(0);
                            o_aef.ˎ(this.ˋॱ, 1);
                            this.ꜞ++;
                            this.ॱᐝ.ˋ(0);
                            o_aef.ˎ(this.ॱᐝ, 8);
                            this.ꜞ += 8;
                        }
                        if (z2) {
                            if (!this.ꜟ) {
                                o_adv.ˏ(this.ˋॱ.ˏ, 0, 1);
                                this.ᐝˋ++;
                                this.ˋॱ.ˋ(0);
                                this.ꓸ = this.ˋॱ.ʽ();
                                this.ꜟ = true;
                            }
                            i2 = this.ꓸ * 4;
                            this.ˋॱ.ˏ(i2);
                            o_adv.ˏ(this.ˋॱ.ˏ, 0, i2);
                            this.ᐝˋ = i2 + this.ᐝˋ;
                            short s = (short) ((this.ꓸ / 2) + 1);
                            int i4 = (s * 6) + 2;
                            if (this.ʿ == null || this.ʿ.capacity() < i4) {
                                this.ʿ = ByteBuffer.allocate(i4);
                            }
                            this.ʿ.position(0);
                            this.ʿ.putShort(s);
                            i2 = 0;
                            i3 = 0;
                            while (i2 < this.ꓸ) {
                                ʽॱ = this.ˋॱ.ʽॱ();
                                if (i2 % 2 == 0) {
                                    this.ʿ.putShort((short) (ʽॱ - i3));
                                } else {
                                    this.ʿ.putInt(ʽॱ - i3);
                                }
                                i2++;
                                i3 = ʽॱ;
                            }
                            i2 = (i - this.ᐝˋ) - i3;
                            if (this.ꓸ % 2 == 1) {
                                this.ʿ.putInt(i2);
                            } else {
                                this.ʿ.putShort((short) i2);
                                this.ʿ.putInt(0);
                            }
                            this.ॱˎ.ॱ(this.ʿ.array(), i4);
                            o_aef.ˎ(this.ॱˎ, i4);
                            this.ꜞ += i4;
                        }
                    }
                } else if (dVar.ʻ != null) {
                    this.ॱˋ.ॱ(dVar.ʻ, dVar.ʻ.length);
                }
                this.ᐧ = true;
            }
            i2 = this.ॱˋ.ॱ() + i;
            if ("V_MPEG4/ISO/AVC".equals(dVar.ˏ) || "V_MPEGH/ISO/HEVC".equals(dVar.ˏ)) {
                byte[] bArr2 = this.ˊॱ.ˏ;
                bArr2[0] = (byte) 0;
                bArr2[1] = (byte) 0;
                bArr2[2] = (byte) 0;
                int i5 = dVar.ᐧ;
                ʽॱ = 4 - dVar.ᐧ;
                while (this.ᐝˋ < i2) {
                    if (this.ㆍ == 0) {
                        ˏ(o_adv, bArr2, ʽॱ, i5);
                        this.ˊॱ.ˋ(0);
                        this.ㆍ = this.ˊॱ.ʽॱ();
                        this.ͺ.ˋ(0);
                        o_aef.ˎ(this.ͺ, 4);
                        this.ꜞ += 4;
                    } else {
                        this.ㆍ -= ॱ(o_adv, o_aef, this.ㆍ);
                    }
                }
            } else {
                if (dVar.ॱʽ != null) {
                    if (this.ॱˋ.ॱ() != 0) {
                        z = false;
                    }
                    amm.ˏ(z);
                    dVar.ॱʽ.ˏ(o_adv, this.ᐨ, i2);
                }
                while (this.ᐝˋ < i2) {
                    ॱ(o_adv, o_aef, i2 - this.ᐝˋ);
                }
            }
            if ("A_VORBIS".equals(dVar.ˏ)) {
                this.ॱˊ.ˋ(0);
                o_aef.ˎ(this.ॱˊ, 4);
                this.ꜞ += 4;
            }
        }
    }

    private void ˋ(adv o_adv, byte[] bArr, int i) throws IOException, InterruptedException {
        int length = bArr.length + i;
        if (this.ᐝॱ.ˎ() < length) {
            this.ᐝॱ.ˏ = Arrays.copyOf(bArr, length + i);
        } else {
            System.arraycopy(bArr, 0, this.ᐝॱ.ˏ, 0, bArr.length);
        }
        o_adv.ˏ(this.ᐝॱ.ˏ, bArr.length, i);
        this.ᐝॱ.ˏ(length);
    }

    private void ˋ(d dVar, String str, int i, long j, byte[] bArr) {
        ˏ(this.ᐝॱ.ˏ, this.ˑ, str, i, j, bArr);
        dVar.ᐝˋ.ˎ(this.ᐝॱ, this.ᐝॱ.ॱ());
        this.ꜞ += this.ᐝॱ.ॱ();
    }

    private static void ˏ(byte[] bArr, long j, String str, int i, long j2, byte[] bArr2) {
        Object obj;
        if (j == -9223372036854775807L) {
            obj = bArr2;
        } else {
            long j3 = j - (((long) (((int) (j / 3600000000L)) * 3600)) * 1000000);
            j3 -= ((long) (((int) (j3 / 60000000)) * 60)) * 1000000;
            int i2 = (int) ((j3 - (((long) ((int) (j3 / 1000000))) * 1000000)) / j2);
            obj = anr.ˊ(String.format(Locale.US, str, new Object[]{Integer.valueOf(r2), Integer.valueOf(r3), Integer.valueOf(r6), Integer.valueOf(i2)}));
        }
        System.arraycopy(obj, 0, bArr, i, bArr2.length);
    }

    private void ˏ(adv o_adv, byte[] bArr, int i, int i2) throws IOException, InterruptedException {
        int min = Math.min(i2, this.ॱˋ.ˊ());
        o_adv.ˏ(bArr, i + min, i2 - min);
        if (min > 0) {
            this.ॱˋ.ˎ(bArr, i, min);
        }
        this.ᐝˋ += i2;
    }

    private int ॱ(adv o_adv, aef o_aef, int i) throws IOException, InterruptedException {
        int ˊ = this.ॱˋ.ˊ();
        if (ˊ > 0) {
            ˊ = Math.min(i, ˊ);
            o_aef.ˎ(this.ॱˋ, ˊ);
        } else {
            ˊ = o_aef.ˏ(o_adv, i, false);
        }
        this.ᐝˋ += ˊ;
        this.ꜞ += ˊ;
        return ˊ;
    }

    private aea ᐝ() {
        int i = 0;
        if (this.ˈ == -1 || this.ˋˊ == -9223372036854775807L || this.ˎˎ == null || this.ˎˎ.ˊ() == 0 || this.ͺॱ == null || this.ͺॱ.ˊ() != this.ˎˎ.ˊ()) {
            this.ˎˎ = null;
            this.ͺॱ = null;
            return new e(this.ˋˊ);
        }
        int ˊ = this.ˎˎ.ˊ();
        int[] iArr = new int[ˊ];
        long[] jArr = new long[ˊ];
        long[] jArr2 = new long[ˊ];
        long[] jArr3 = new long[ˊ];
        for (int i2 = 0; i2 < ˊ; i2++) {
            jArr3[i2] = this.ˎˎ.ˏ(i2);
            jArr[i2] = this.ˈ + this.ͺॱ.ˏ(i2);
        }
        while (i < ˊ - 1) {
            iArr[i] = (int) (jArr[i + 1] - jArr[i]);
            jArr2[i] = jArr3[i + 1] - jArr3[i];
            i++;
        }
        iArr[ˊ - 1] = (int) ((this.ˈ + this.ʽॱ) - jArr[ˊ - 1]);
        jArr2[ˊ - 1] = this.ˋˊ - jArr3[ˊ - 1];
        this.ˎˎ = null;
        this.ͺॱ = null;
        return new adt(iArr, jArr, jArr2, jArr3);
    }

    private boolean ˋ(adz o_adz, long j) {
        if (this.ˌ) {
            this.ˋᐝ = j;
            o_adz.ˊ = this.ˋˋ;
            this.ˌ = false;
            return true;
        } else if (!this.ˉ || this.ˋᐝ == -1) {
            return false;
        } else {
            o_adz.ˊ = this.ˋᐝ;
            this.ˋᐝ = -1;
            return true;
        }
    }

    private long ॱ(long j) throws ParserException {
        if (this.ʾ == -9223372036854775807L) {
            throw new ParserException("Can't scale timecode prior to timecodeScale being set.");
        }
        return anr.ॱ(j, this.ʾ, 1000);
    }

    private static boolean ॱ(String str) {
        if ("V_VP8".equals(str) || "V_VP9".equals(str) || "V_MPEG2".equals(str) || "V_MPEG4/ISO/SP".equals(str) || "V_MPEG4/ISO/ASP".equals(str) || "V_MPEG4/ISO/AP".equals(str) || "V_MPEG4/ISO/AVC".equals(str) || "V_MPEGH/ISO/HEVC".equals(str) || "V_MS/VFW/FOURCC".equals(str) || "V_THEORA".equals(str) || "A_OPUS".equals(str) || "A_VORBIS".equals(str) || "A_AAC".equals(str) || "A_MPEG/L2".equals(str) || "A_MPEG/L3".equals(str) || "A_AC3".equals(str) || "A_EAC3".equals(str) || "A_TRUEHD".equals(str) || "A_DTS".equals(str) || "A_DTS/EXPRESS".equals(str) || "A_DTS/LOSSLESS".equals(str) || "A_FLAC".equals(str) || "A_MS/ACM".equals(str) || "A_PCM/INT/LIT".equals(str) || "S_TEXT/UTF8".equals(str) || "S_TEXT/ASS".equals(str) || "S_VOBSUB".equals(str) || "S_HDMV/PGS".equals(str) || "S_DVBSUB".equals(str)) {
            return true;
        }
        return false;
    }

    private static int[] ˊ(int[] iArr, int i) {
        if (iArr == null) {
            return new int[i];
        }
        return iArr.length < i ? new int[Math.max(iArr.length * 2, i)] : iArr;
    }
}
